const http = require('http')
const url = require('url')

const app = http.createServer((req, res) => {
    const path = req.url
    //console.log(req);
    console.log(path);
    //转换url
    const result = url.parse(path, true) //第一个参数为地址，第二个参数true表示将get传值转换为对象
    console.log(result);
    res.end('Hello Node.js!');
})

app.listen(8080)

console.log('Server running at http://127.0.0.1:8080')